﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Prsrp
{
    public class StandardHeroBullet : BaseHeroProjectile
    {
        public StandardHeroBullet(Vector2 _vPos)
        {
            LoadSprites();
            mvSize = new Vector2(mtabStateSprites[0].Width, mtabStateSprites[0].Height);
            mvPos = _vPos;
            mvSpeed.X = 20;
        }

        public override void Update()
        {
            // Handle collisions with enemies.
            Rectangle pCurHitBox = GetHitBox();
            foreach (BaseEnemy pCurEnemy in Game.Engine.CurrentLevel.Enemies)
            {
                // If we touch a enemy.
                if (pCurHitBox.Intersects(pCurEnemy.GetHitBox()))
                {
                    pCurEnemy.Callback_OnHit(this);
                    Game.Engine.CurrentLevel.AddParticle(new BulletExplosion(mvPos));
                    Dispose();
                }
            }
            base.Update();
        }

        public override void OnHit(BaseEnemy _pCharacter)
        {
            throw new NotImplementedException();
        }

        public override void LoadSprites()
        {
            DefineSprite(0, "bullet_medium", 1);
        }
    }
}
